#ifndef TUNNEL_STRUCKTS_H
#define TUNNEL_STRUCKTS_H

#include <QtCore/QString>

// +-Packagetyps
// +------Command Category
// +----------Command
#define TUNNEL_PACKAGETYP_SYSTEM                    0 // System
#define     TUNNEL_COMMANDCATEGORY_COMM                 0 // Communication
#define         TUNNEL_COMMAND_AUTH                         0 // Authentification

#define     TUNNEL_COMMANDCATEGORY_FRIENDS              1 // Friends
#define         TUNNEL_COMMAND_UPDATEFRIENDLIST             0 // Update friendlist
#define         TUNNEL_COMMAND_ADDFRIEND                    1 // Add friend
#define         TUNNEL_COMMAND_GETFRIENDREQUESTS            2 // Get friend requests
#define         TUNNEL_COMMAND_ACCEPTFRIENDINVENTATION      3 // Accept friendship inventation
#define         TUNNEL_COMMAND_FRIENDGOESONLINE             4 // Friend turned status from offline to online.
#define         TUNNEL_COMMAND_FRIENDGOESOFFLINE            5 // Friend turned status from online to offline.

#define     TUNNEL_COMMANDCATEGORY_ERROR                2 // Error
#define         TUNNEL_COMMAND_ERRORMESSAGE                 0 // Error message



#define TUNNEL_PACKAGETYP_MESSAGE                   1 // Message


// Packagetyps
//
// Global Package
// * Packagetyp
//
// Message Package
// * Packagetyp = Message
// * To (recepient)
// * Message
// * From (sender)
//
// System Package
// * Packagetyp = System
// * Command Category
// * Command
// * Command Arguments
struct Package
{
    quint16 typ;                // Global Package
    QString message;            // Message Package
    QString from;               // Message Package
    QString to;                 // Message Package
    quint16 commandCategory;    // System Package
    quint16 command;            // System Package
    QString arguments;          // System Package
};

inline void setupSystemPackage(Package *package, quint16 category, quint16 command, QString arguments = "")
{
    package->typ             = TUNNEL_PACKAGETYP_SYSTEM;
    package->commandCategory = category;
    package->command         = command;
    package->arguments       = arguments;
}

inline void setupMessagePackage(Package *package, const QString &from, const QString &message, const QString &to = "")
{
    package->typ     = TUNNEL_PACKAGETYP_MESSAGE;
    package->from    = from;
    package->to      = to;
    package->message = message;
}

#endif // TUNNEL_STRUCKTS_H
